<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>

/*    //1.if
    var count = 3;
    if(count == 3) {
        alert(count);
    }*/


/*    //2.switch
    var num = 3;
    switch (num) {
        case 1:
            alert("星期一");
            break;
        case 2:
            alert("星期二");
            break;
        case 3:
            alert("星期三");
            break;
        case 4:
            alert("星期四");
            break;
        case 5:
            alert("星期五");
            break;
        case 6:
            alert("星期六");
            break;
        case 7:
            alert("星期日");
            break;
        default:
            alert("输入的星期有误");
            break;
    }*/


    //3.for

/*    var sum = 0;
    for (let i = 1; i <= 100; i++) { //建议for循环小括号中定义的变量使用let
        sum += i;
    }
    alert(sum);*/

    //4.while

/*    var sum = 0;
    var i = 1;
    while (i <= 100) {
        sum += i;
        i++;
    }
    alert(sum);*/


    //5.do...while
    var sum = 0;
    var i = 1;
    do {
        sum += i;
        i++;
    }
    while (i <= 100);
    alert(sum);

</script>
</body>
</html>